// components/swiper/index.js
const app = getApp();
import { baseUrl } from "../../api/request"
Component({
    data: {
        baseUrl: baseUrl,
        scFlag: false,
        data: {}
    },
    properties: {
        data: {
            type: Object,
            value: {},
            observer: function (val) {
                this.setData({
                    data: val
                });
            },
        },
        state: {
            type: Object,
            value: {
                autoplay: true,  //自动切换
                dots: true,  //指示点
                dotsColor: "#ffffff", //指示点颜色
                dotsActiveColor: "#4646A0",//选中指示点颜色
                circular: true, //衔接滑动
                duration: 3000, //滑动动画时长
                boxFlag: false,
            }
        },
    },
    lifetimes: {
        attached() {

        },
        detached() { },
    },
    methods: {
        //点赞和取消点赞按钮事件
        collection(e) {
            const item = e.currentTarget.dataset.item;
            this.triggerEvent("ctionEvent", item);
        },
        //取消收藏和点击收藏
        collectionClick(e) {
            const item = e.currentTarget.dataset.item;
            this.triggerEvent("collectionEvent", item);
        },
        //地址点击事件
        navigationTap(e) {
            let item = e.currentTarget.dataset.item;
            wx.openLocation({
                latitude: Number(item.latitude),
                longitude: Number(item.longitude),
            });
        },
    }
})